class RefactorRating < ActiveRecord::Migration
  def up
  	remove_column :reviews, :value
  	add_column :reviews, :overall_rating_value, :integer 
  	drop_table :ratings_reviews
  	drop_table :ratings
  	
    create_table :ratings, :id => false  do |t|
      t.references :rating_criterion
      t.references :review
      t.integer :rating_value
    end
    add_index :ratings, :rating_criterion_id
    add_index :ratings, :review_id
  end
  def down
  	raise ActiveRecord::IrreversibleMigration 
  end
end
